import { Component } from 'react';

import { Switch,Group,Dialog, TextField,TextareaField,SelectField,CheckboxField,Button,Datetime,Toast,Boxs,Popup} from 'saltui';
const {HBox,Box,VBox} = Boxs;
import './PageHome.less';
import AngleRight from 'salt-icon/lib/AngleRight';
import DB from '../../../app/db';
import SelectMember from 'components/selectMember';
import Map from 'components/map';
import Upload from 'components/upload';
import SelectBoardoom from 'pages/meeting/selectBoardroom';
import utils from 'components/selectMember/utils';
const {Count} = TextareaField;
const numberRegExp = /^(\d+\.\d*)|(\d+\.)|\d+/;
var $thirdMenuType = getLoginUserInfo().thirdMenuType;

var hasStart = false;

const signTimeData = [
  { value: 10, text: '开始前10分钟' },
  { value: 30, text: '开始前30分钟' },
  { value: 60, text: '开始前1小时' },
  { value: 0, text: '不限时'}
];

const signTypeData = [{ value: '0', text: '扫码' },{ value: '1', text: '定位' },{ value: '2', text: '扫码+定位' },{ value: '3', text: '现场签到' }];
let signTypeData1  = null;

const signRangeData = [
  { value: '100', text: '100米' },{ value: '200', text: '200米' },{ value: '300', text: '300米' },
  { value: '400', text: '400米' },{ value: '500', text: '500米' },{ value: '1000', text: '1000米' }
];

const remindTimeData = [
  { value: 10, text: '开始前10分钟' },
  { value: 30, text: '开始前30分钟' },
  { value: 60, text: '开始前1小时' }
];

const repeatTypeData = [
  { value: 0, text: '按天' },
  { value: 1, text: '按周' }
];

export default class PageHome extends Component {

  handleTextChange(field, newValue, size) {
    if (newValue.length <= size) {
      this.setState({
        [field]: newValue,
      });
    }
  }

   handleChange(field, value) {
    console.log(value);
    this.setState({
      [field]: value,
    });
  }

  constructor(props) {
    super(props);
    var thirdMenuType = getLoginUserInfo().thirdMenuType;
    if(thirdMenuType == 'DING'){
      dd.biz.navigation.setTitle({
        title : "发布会议通知",//控制标题文本，空字符串表示显示默认文本
        onSuccess : function(result) {},
        onFail : function(err) {}
      });
    }else if(thirdMenuType =='MH'){
      !!emp&&emp.window.setTitle({
        title: {
            text: "发布会议通知",
            icon: '',
            actionmenu: {}
        },
      });
    }
    let meetingId = this.props.params.id;
    if (meetingId == null || meetingId == '' || meetingId == undefined || meetingId == 'undefined') {
      meetingId = '';
    }

    var startTime = this.props.params.startTime;
    var endTime = this.props.params.endTime;
    if(startTime==undefined || startTime==null || startTime == 'undefined' || startTime==""){
      startTime = endTime = this.getCurrentTime();
    }
    let view = this.props.params.view;
    scrollTo(0, 0);
    //关闭加载页的遮罩效果
    $(".loading-containter").hide();
    //禁用ios弹性事件
    dd.ui.webViewBounce.disable();

    let t = this;
    let userId = document.getElementById("userHiddenId").value;
    var isHelpNew = 1;
    dd.util.domainStorage.getItem({ //帮助按钮
         name:'meeting_helpNew_'+userId , // 存储信息的key值
         onSuccess : function(info) {
              var helpNew = info.value;
              if( typeof(helpNew) == 'undefined' || helpNew == '' ){
                isHelpNew = 2;
              }
              //初始化按钮
              t.initButton(isHelpNew);
         },
         onFail : function(err) {
              //alert(JSON.stringify(err));
         }
      });

      let _repetitiveMonthDate=[];
      for(var i = 1; i <= 31; i++){
        let option = {text : i + "日", value : i};
        _repetitiveMonthDate.push(option);
      }

    // 会议方式
    let meetingWays = [
      { value: 0, text: '现场会议'},
      { value: 1, text: '网络会议' },
      { value: 2, text: '现场+网络' },
    ];

    let meetingModes = [
      { value: 0, text: '普通会议'},
      { value: 1, text: '周期会议' }
    ];

    let meetingAddressTypes = [
      { value: 0, text: '已预定的会议室'},
      { value: 1, text: '自定义会议地点' }
    ]

    this.state = {
      thirdMenuType:$thirdMenuType,
      meetingId:meetingId,
      name:'',
      meetingType:null,
      meetingTypes:[],
      theme:'',
      remark: '',
      startTime: startTime,
      endTime: endTime,
      startSelect: {value:0},
      endSelect: {value:0},
      periodicMt :false,
      repeatTypeData:repeatTypeData,
      repeatType:repeatTypeData[0],
      endDate: new Date().format("yyyy-MM-dd HH:mm"),
      meetingRoomData:[],
      meetingRoom:{},
      meetingServerData: [],
      meetingServer:{},
      messagePush:'',
      messagePushData:[],
      meetingWays: meetingWays,
      meetingWay:null,
      isSync:1,
      meetingModes:meetingModes,
      meetingMode:meetingModes[0],
      meetingAddressTypes: meetingAddressTypes,
      meetingAddressType: meetingAddressTypes[1],

      isCycle:false,
      cycleType:{},
      cycleTypeData:[],
      cycleValue:"",
      cycleId:"",
      cycleEndTime: new Date().format("yyyy-MM-dd"),
      cycleEndTimeSelect:{},
      intervalDate:"",
      repetitiveWeek:"",
      repetitiveWeekData:[],
      repetitiveMonth:{},
      repetitiveMonthData:_repetitiveMonthDate,

      emceeUser: '',
      memoUser: '',
      attendUser: '',
      attendants: '',
      emceeUserList: [],//默认主持人
      jsonStrEmceeUser: '',
      jsonStrMemoUser: '',
      jsonStrAttendUser: '',
      jsonStrAttendants: '',
      boardroomId: '',
      boardroomName:'',
      limitDate:'',
      meetingPeopleNum:'',

      meetingRemind:false,
      remindTypeData:[],
      remindTime:remindTimeData[0],
      remindType:{},
      meetingSign:false,
      signTimeData: signTimeData,
      signTypeData: signTypeData,
      signType: signTypeData[0],
      signTime: signTimeData[0],
      signRangeData: signRangeData,
      signRange: signRangeData[0],
      addressList: [],
      status:'',
      messagePushSW:'',
      isSyncCalendar:true,

      view: view,
      longitude:117,
      latitude:31,

      fileId:'',
      attIdJson:[],

      address:'',
      canSelectBoardroom:true,
      visible:false,

      deleteId:"",
      oldId:""
    }
  }

  componentDidMount(){
    let t = this;
    let meetingId = this.state.meetingId;
    let _type=this.state.view?this.state.view:"add";   
    /* if(meetingId != null && meetingId != '' && meetingId != undefined && meetingId != 'undefined'){
       _type='edit';
     }*/
    var roomId = this.state.boardroomId;
    var paramInfo = {id: meetingId, boardroomId: roomId, type:_type};
    DB.SomeModuleAPI.applyRecordInfo(paramInfo).then((content) => {

      //签到方式
      if(content.signedTypeStr!=""){
        signTypeData1=eval('(' + content.signedTypeStr + ')');
        t.setState({
          signTypeData: signTypeData1,
          signType: signTypeData1[0]
        }); 
      }
      //会议方式
      let meetingWays=[];
      if(content.meetingWayStr!=""){
        meetingWays=eval('(' + content.meetingWayStr + ')');
      }
      let data = content.applyRecord;
      let roomData = content.boardroomSetList;
      let roomcheck = null;      
      var roomAddressList = [];
      let limitDate = "";
      if (content.boardroomSet != null) {
        var rId = content.boardroomSet.id;
        for(var i=0; i<roomData.length; i++){
          if(roomData[i].value == rId){
            roomcheck = roomData[i];
            break;
          }
        }
      }else{
        if(roomId!="" && roomId!=undefined && roomId!='undefined'){
          for(var i=0;i<roomData.length;i++){
            if(roomId == roomData[i].value){
              roomcheck = roomData[i];
            }
          }
          var boardRoom = content.boardRoom;
          if(boardRoom.position!=null && boardRoom.position!=""){
            limitDate = content.limitDate;
            var addr = {
              lng: boardRoom.longitude + "",
              lat: boardRoom.latitude + "",
              address: boardRoom.position
            };
            roomAddressList.push(addr);
          }
        }
      }
      let noticecheck = content.applyRecord.noticeType;
      var noticechecks = [];

      if(noticecheck!=null && noticecheck!=""){
        noticechecks = noticecheck.split(",");
      }

      var noticeTypeList = content.noticeTypeList;
      if (noticeTypeList != null) {
        for(var i=0; i<noticeTypeList.length;i++){
          if(noticecheck!=null  && noticecheck!=""){
            for(var j=0;j<noticechecks.length;j++){
              if(noticeTypeList[i].value == noticechecks[j]){
                noticeTypeList[i].checked = true;
              }
            }
          }
        }
      }
      let servecheck = content.applyRecord.meetingServe;
      var servechecks = [];
      if(servecheck!=null && servecheck!=""){
        servechecks = servecheck.split(",");
      }
      var serveSetList = content.serveSetList;
      if (serveSetList != null) {
        for(var i=0; i<serveSetList.length;i++){
          if(servecheck!=null && servecheck!=""){
            for(var j=0; j<servechecks.length;j++){
              if(serveSetList[i].value == servechecks[j]){
                serveSetList[i].checked = true;
              }
            }
          }
        }
      }
      
      var meetingTypes = [];
      var _meetingTypes = content.meetingTypes;
      if (_meetingTypes != null) {
        for(var i=0; i<_meetingTypes.length;i++){
          var temp={
            text:_meetingTypes[i].name,
            value:_meetingTypes[i].id
          }
          meetingTypes.push(temp);
        }
      }
      let messagePush = content.applyRecord.messagePush;
      let messagePushSW = content.messagePushSW;//后台base设置
      let messagePushData = [];
      let hasMessagePush=!(messagePush==null||messagePush=="null"||messagePush=="");
      // if(){
       // messagePushSW="mobile|2|,sms|2|,";
        if(_type=="edit"){
          if(messagePushSW.indexOf("email") > -1) {
            let moduleLocation = messagePushSW.indexOf("email");
            let type = messagePushSW.substring(moduleLocation+6,moduleLocation+7);
            if (type == "2"){
              if(hasMessagePush && messagePush.indexOf("email")<0){
                messagePushData.push({value: 'email', text: '邮件'});
              }else {
                if(hasMessagePush){
                  messagePushData.push({value: 'email', text: '邮件', checked:true });
                }else messagePushData.push({value: 'email', text: '邮件'});
              }
            }  else if(type == "1") {
              if(hasMessagePush && messagePush.indexOf("email")>-1){
                messagePushData.push({value: 'email', text: '邮件', checked:true});
              }else 
               messagePushData.push({value: 'email', text: '邮件' });
            }
          }
          if(messagePushSW.indexOf("mobile") > -1) {
            let moduleLocation = messagePushSW.indexOf("mobile");
            let type = messagePushSW.substring(moduleLocation+7,moduleLocation+8);
            if (type == "2"){
              if(hasMessagePush && messagePush.indexOf("mobile")<0){
                messagePushData.push({value: 'mobile', text: '移动端'});
              }else {
                if(hasMessagePush){
                  messagePushData.push({value: 'mobile', text: '移动端', checked:true  });
                }else messagePushData.push({value: 'mobile', text: '移动端'});
              }
             
            }  else if(type == "1") {
              if(hasMessagePush && messagePush.indexOf("mobile")>-1){
                messagePushData.push({value: 'mobile', text: '移动端', checked:true });
              }else
              messagePushData.push({value: 'mobile', text: '移动端' });
            }
          }
          if(messagePushSW.indexOf("sms") > -1) {
            let moduleLocation = messagePushSW.indexOf("sms");
            let type = messagePushSW.substring(moduleLocation+4,moduleLocation+5);
            if (type == "2"){
              if(hasMessagePush && messagePush.indexOf("sms")<0){
                messagePushData.push({value: 'sms', text: '短信'});
              }else {
                if(hasMessagePush){
                  messagePushData.push({value: 'sms', text: '短信', checked:true  });
                }else messagePushData.push({value: 'sms', text: '短信'});
              }
            }  else if(type == "1") {
              if(hasMessagePush && messagePush.indexOf("sms")>-1){
                messagePushData.push({value: 'sms', text: '短信', checked:true });
              }else
              messagePushData.push({value: 'sms', text: '短信' });
            }
          
          }

        }else if(_type=="add"){
          if(messagePushSW.indexOf("email") > -1) {
            let moduleLocation = messagePushSW.indexOf("email");
            let type = messagePushSW.substring(moduleLocation+6,moduleLocation+7);
            if (type == "2"){
              messagePushData.push({value: 'email', text: '邮件', checked:true });
              if(messagePush ){
                messagePush  += ",email";
              }else{
                messagePush = "email";
              }
            }  else if(type == "1") {
              if(hasMessagePush && messagePush.indexOf("email")>-1){
                messagePushData.push({value: 'email', text: '邮件', checked:true});
              }else 
               messagePushData.push({value: 'email', text: '邮件' });
            }
          }
          if(messagePushSW.indexOf("mobile") > -1) {
            let moduleLocation = messagePushSW.indexOf("mobile");
            let type = messagePushSW.substring(moduleLocation+7,moduleLocation+8);
            if (type == "2"){
                messagePushData.push({value: 'mobile', text: '移动端', checked:true  });
                if(messagePush){
                  messagePush += ",mobile";
                }else messagePush = "mobile";
                
            }  else if(type == "1") {
              if(hasMessagePush && messagePush.indexOf("mobile")>-1){
                messagePushData.push({value: 'mobile', text: '移动端', checked:true });
              }else
              messagePushData.push({value: 'mobile', text: '移动端' });
            }
          }
          if(messagePushSW.indexOf("sms") > -1) {
            let moduleLocation = messagePushSW.indexOf("sms");
            let type = messagePushSW.substring(moduleLocation+4,moduleLocation+5);
            if (type == "2"){
                messagePushData.push({value: 'sms', text: '短信', checked:true  });
                if(messagePush){
                  messagePush+= ",sms";
                }else messagePush= "sms";
            }  else if(type == "1") {
              if(hasMessagePush && messagePush.indexOf("sms")>-1){
                messagePushData.push({value: 'sms', text: '短信', checked:true });
              }else
              messagePushData.push({value: 'sms', text: '短信' });
            }
          
          }

        }


        
    
      // }

      // 重复类型
      let cycleTypeData = [
        { value: 0, text: '按天'},
        { value: 1, text: '按周' },
        { value: 2, text: '按月' }
      ];

      let repetitiveWeekData=[
        { value: 1, text: '星期天' },
        { value: 2, text: '星期一' },
        { value: 3, text: '星期二' },
        { value: 4, text: '星期三' },
        { value: 5, text: '星期四' },
        { value: 6, text: '星期五' },
        { value: 7, text: '星期六' }
      ];

      let _repetitiveMonthDate = t.state.repetitiveMonthData;
      let _isCycle = false;
      let _cycleType = {};
      let _cycleValue = content.applyRecord.cycleValue;
      let _cycleEndTime = new Date().format("yyyy-MM-dd");
      let _intervalDate="",_repetitiveWeek="",_repetitiveMonth={};
      if(content.applyRecord.isCycle == 1){
        _isCycle = true;
        let cycleType = content.applyRecord.cycleType;
        if(cycleType == 0){
          _cycleType = cycleTypeData[0];
          _intervalDate = _cycleValue;
        }else if(cycleType == 1){
          _cycleType = cycleTypeData[1];
          let week = _cycleValue.split(",");
          for(let i = 0; i < week.length; i++){
            repetitiveWeekData[week[i]-1].checked = true;
          }
          _repetitiveWeek = _cycleValue;
        }else if(cycleType == 2){
          _cycleType = cycleTypeData[2];
          _repetitiveMonth = _repetitiveMonthDate[_cycleValue - 1];
        }
        _cycleEndTime = content.applyRecord.cycleEndTime;
      }else{
        _cycleType = cycleTypeData[0];
        _repetitiveMonth = _repetitiveMonthDate[0];
      }

      let meetingWayValue = content.applyRecord.meetingWay;
      let meetingWay={};
      for(let i=0;i<meetingWays.length;i++){
        if(meetingWays[i].value==meetingWayValue){
          meetingWay=meetingWays[i];
          break;
        }
      }
      if(Object.getOwnPropertyNames(meetingWay).length==0 && meetingWays.length>0){
        meetingWay=meetingWays[0];
      }
      let canSelectBoardroom = true;
      let boardroomName = "";
      let address="";
      let meetingAddressType = this.state.meetingAddressType;
      if(content.applyRecord.boardroomId){
        if(content.boardroomSet != null && content.boardroomSet.name != null) {
          boardroomName = content.boardroomSet.name;
          // canSelectBoardroom = false;
        }
      }else{
        if(content.applyRecord.address != null) {
          address = content.applyRecord.address;
          meetingAddressType = this.state.meetingAddressTypes[1];
        }
      }
     
      t.setState({
        userName:content.userName,
        orgName:content.orgName,
        boardroomId: content.applyRecord.boardroomId,
        boardroomName: boardroomName,
        address: address,
        meetingAddressType: meetingAddressType,
        isCycle:_isCycle,
        cycleType:_cycleType,
        cycleTypeData:cycleTypeData,
        cycleValue:_cycleValue,
        cycleEndTime: _cycleEndTime,
        cycleEndTimeSelect:{value: new Date(_cycleEndTime).getTime()},
        intervalDate:_intervalDate,
        repetitiveWeek:_repetitiveWeek,
        repetitiveWeekData:repetitiveWeekData,
        repetitiveMonth:_repetitiveMonth,
        repetitiveMonthData:_repetitiveMonthDate,
        meetingWays:meetingWays,
        meetingWay: meetingWay,
        messagePush: messagePush,
        messagePushData:messagePushData,
        meetingTypes:meetingTypes,
        meetingRoomData:roomData,
        meetingRoom:roomcheck,
        remindTypeData:content.noticeType,
        meetingServerData:serveSetList ? serveSetList : [],
        addressList: roomAddressList,
        messagePushSW:messagePushSW,
        limitDate:limitDate,
        canSelectBoardroom:canSelectBoardroom,
        oldId: content.applyRecord.id
      });
      
      if (meetingId != '') {
        let _meetingType = null;
        for(var i=0;i<meetingTypes.length;i++){
          if(data.meetingTypeId == meetingTypes[i].value){
            _meetingType = meetingTypes[i];
          }
        }
        let remindTime = {};
        let noticeTime = data.noticeTime;
        if(remindTimeData!=null&&remindTimeData.length>0){
          if(noticeTime == '10'){
            remindTime = remindTimeData[1];
          }else if (noticeTime == '30') {
            remindTime = remindTimeData[2];
          } else if (noticeTime == '60') {
            remindTime = remindTimeData[3];
          }else {
            remindTime = remindTimeData[0];
          }
       }

        let signTime = {};
        let signedTime = data.signedTime;
        if(signTimeData!=null&&signTimeData.length>0){
          if (signedTime == '30') {
            signTime = signTimeData[1];
          } else if (signedTime == '60') {
            signTime = signTimeData[2];
          } else if(signedTime == '0'){
            signTime = signTimeData[3];
          } else{
            signTime = signTimeData[0];
          }
        }
        let signType = '';
        let signedType = data.signedType;
        
        if(signTypeData1!=null&&signTypeData1.length>0){
          signType = signTypeData1[0];
          for(var i=0;i<signTypeData1.length;i++){
            if(signedType == signTypeData1[i].value){
              signType = signTypeData1[i];
            }
          }
        }
        let signRange = '';
        let signedRange = data.signedRange;
        if(signRangeData!=null&&signRangeData.length>0){
          signRange = signRangeData[0];
          for(var i=0;i<signRangeData.length;i++){
            if(signedRange == signRangeData[i].value){
              signRange = signRangeData[i];
            }
          }
        }

        let repeatType = {};
        let cycleType = data.cycleType;
        if(repeatTypeData!=null&&repeatTypeData.length>0){
          if (cycleType == '0') {
            repeatType = repeatTypeData[0];
          } else if (cycleType == '1'){
            repeatType = repeatTypeData[1];
          } 
        }
        
        var startSelect = data.startTime, endSelect = data.endTime;
        if(startSelect!=null && startSelect!=undefined && startSelect!=""){
          t.setState({
            startTime: startSelect,
            endTime: endSelect,
            startSelect: {value: new Date(startSelect).getTime()},
            endSelect: {value: new Date(endSelect).getTime()}
          });
        }

        var addressList = content.addressList;
        if(addressList==null || addressList==undefined || addressList.length<=0){
          var boardroomSet = content.boardroomSet;
          addressList = [];
          if(boardroomSet != null && boardroomSet.position!=null && boardroomSet.position!=""){
            var addr = {
              lng: boardroomSet.longitude + "",
              lat: boardroomSet.latitude + "",
              address: boardroomSet.position
            };
            addressList.push(addr);
          }
        }
        
        let _fileId = "";
        if(content.fileIds != "")_fileId = content.fileIds;
        let _attIdJson=[];
        if(content.attIdJson != null) _attIdJson=content.attIdJson;
        
        let _theme = data.content == null ? "" : data.content;
        let _remark = data.remark == null ? "" : data.remark;

        t.setState({
          name:data.name,
          meetingType:_meetingType,
          theme:_theme,
          remark:_remark,
          periodicMt:data.isCycle,
          repeatType:repeatType,
          endDate:data.cycleEndTime,

          emceeUser:data.emceeUser,
          memoUser:data.memoUser,
          attendUser:data.attendUser,
          attendants:data.meetingAttendants,
          meetingRemind:data.isNotice,
          remindTime:remindTime,
          meetingSign:data.isSigned,
          signTime:signTime,
          signedTime:signedTime,
          signType:signType,
          signRange:signRange,
          signedRange:signedRange,
          addressList:addressList,
          fileId:_fileId,
          attIdJson:_attIdJson,
        }, function(){
          t.refs.selectMember_emceeUser.initSelectData();
          t.refs.selectMember_memoUser.initSelectData();
          t.refs.selectMember_attendUser.initSelectData();
          t.refs.selectMember_attendants.initSelectData();
          t.refs.upload.initData();
        });
      }else{
          var startSelect = t.state.startTime;
          var endSelect = t.state.endTime;
          if(startSelect == ""){
            startSelect = t.getCurrentTime();
          }
          if(endSelect == ""){
             endSelect = t.getCurrentTime();
          }
         
        t.setState({
          emceeUserList:content.emceeUserList,
          startTime: startSelect,
          endTime: endSelect,
          startSelect: {value: new Date(startSelect).getTime()},
          endSelect: {value: new Date(endSelect).getTime()}
        }, function(){
          this.refs.selectMember_emceeUser.initSelectData();
        });
      }
      
      //t.getGeolocation();
    }).catch((error) => {
      alert(JSON.stringify(error));
    });

  }

  componentWillUnmount(){
    Dialog.hide();
  }

  //初始化按钮
  initButton(isHelpNew){
    //设置帮助
    /*dd.biz.navigation.setIcon({
        showIcon : true,//是否显示icon
        iconIndex : isHelpNew,//显示的iconIndex,如上图
        onSuccess : function(result) {
            location.hash='help/help_index';
        },
        onFail : function(err) {
        //jsapi调用失败将会回调此函数
        }
    });*/
  }

  // 类型改变
  typeChange(field,value){
    console.log(value);
    if(field == 'meetingRoom'){
      DB.SomeModuleAPI.getBoardRoomServeTreeData({boardroomId:value.value}).then((content) => {
        var addressList = [];
        var boardroom = content.boardRoom;
        if(boardroom.position!=null && boardroom.position!=""){
          var addr = {
            lng: boardroom.longitude + "",
            lat: boardroom.latitude + "",
            address: boardroom.position
          };
          addressList.push(addr);
        }

        this.setState({
          meetingServerData: content.serve,
          meetingServer:{},
          addressList: addressList
        });
      })
      .catch((error) => {});
    }
    let t = this;
    if(field == 'meetingMode') {
      this.setState({
        boardroomName : '',
        boardroomId :''
      });
    }
    if((field == 'meetingMode' && value.value == 1 && this.state.meetingAddressType.value == 1) || (field == 'meetingAddressType' && value.value == 1 && this.state.meetingMode.value == 1)){
      this.setState({
        isCycle : true
      });
    }else if(field == 'meetingMode' || field == 'meetingAddressType'){
      this.setState({
        isCycle : false
      });
    }
    this.setState({
      [field]: value,
    });
  }

  changeMessagePush(date){
    let messagePush = "";
    for(let i = 0; i < date.length; i++){
      if(i == date.length-1) messagePush += date[i].value;
      else messagePush += date[i].value + ',';
    }
    this.setState({
      messagePush:messagePush
    });
  }

  //获取联系人
  changeSelectMember(field, newValue){
      this.setState({
        [field]: newValue
      });
  }

  onChange(val) {
    this.setState({
      value: val,
    });
  }

  validateText(text, msg){
    if(!(/^([\u4E00-\u9FA5]|\w|\.)+$/).test(text)){
      Toast.show({
        type: 'error',
        content: msg + '请输入中文/字母/数字/下划线/点',
        onHide: function () {}
      });
      return false;
    }else{
      return true;
    }
  }

  // 发起会议
  startMeeting(){
  
    let t = this;
    //alert(JSON.stringify(this.state.meetingType));
    // return;
    let startTime = '';
    let nowDateTime = new Date().getTime();

    if(this.state.meetingAddressType.value == 1){
       if(this.state.address==""){
          Toast.show({
              type: 'error',
              content: '请输入会议地点！',
              onHide: function () {
              }
          });
          return;
       }
    }

    if(this.state.startTime == null || this.state.startTime == ''){
      Toast.show({
              type: 'error',
              content: '请选择开始时间',
              onHide: function () {
              }
          });
      return;
    }else{
        startTime = this.state.startTime;
        while (startTime.indexOf('-') >= 0){
           startTime = startTime.replace('-', '/');
        }
        
        startTime = new Date(startTime);
        startTime = startTime.getTime();
      if(nowDateTime > startTime){
        Toast.show({
              type: 'error',
              content: '开始时间小于当前时间',
              onHide: function () {
              }
          });
        return;
      }
    }

    let endTime = '';
    if (this.state.endTime == null || this.state.endTime == '') {
      Toast.show({
              type: 'error',
              content: '请选择结束时间',
              onHide: function () {
              }
          });
      return;
    } else {
        endTime = this.state.endTime;
        while (endTime.indexOf('-') >= 0){
           endTime = endTime.replace('-', '/');
        }
        endTime = new Date(endTime);
        endTime = endTime.getTime();
    }
    if (startTime >= endTime) {
      Toast.show({
              type: 'error',
              content: '开始时间需小于结束时间',
              onHide: function () {
              }
          });
      return;
    }

    // 会议服务
    let meetingServe = '';
    if (this.state.meetingServerData != null) {
        let meetingServeList = this.state.meetingServerData;
        for(let i=0; i<meetingServeList.length; i++){
          if(meetingServeList[i].checked){
            meetingServe += meetingServeList[i].value+",";
          }
        }
        if(meetingServe != ""){
          meetingServe = meetingServe.substring(0,meetingServe.length-1);
        }
    }

    let isCycle = this.state.isCycle;
    let cycleType = this.state.cycleType.value;
    let cycleEndTime = this.state.cycleEndTime; 
    let cycleValue = "";
    if(isCycle){
      if(cycleType == 0){
        let intervalDate = this.state.intervalDate;
        if(intervalDate == ""){
          Toast.show({
            type: 'error',
            content: '间隔天数不能为空',
            onHide: function () {}
          });
          return;
        }
        var reg = /^[1-9]\d*|0$/;
        if(!reg.test(intervalDate)){
          Toast.show({
            type: 'error',
            content: '间隔天数应为非负整数',
            onHide: function () {}
          });
          return;
        }
        cycleValue = intervalDate;
      }else if(cycleType == 1){
        let repetitiveWeek = this.state.repetitiveWeek;
        if(repetitiveWeek==null || repetitiveWeek.length == 0){
          Toast.show({
            type: 'error',
            content: '请选择重复星期',
            onHide: function () {}
          });
          return;
        }
        for(let i = 0; i < repetitiveWeek.length; i++){
          if(i == repetitiveWeek.length - 1) cycleValue += repetitiveWeek[i].value;
          else cycleValue += repetitiveWeek[i].value + ',';
        }
      }else if(cycleType == 2){
        let repetitiveMonth = this.state.repetitiveMonth;
        if(repetitiveMonth == null || repetitiveMonth == ""){
          Toast.show({
            type: 'error',
            content: '请选择重复日期',
            onHide: function () {}
          });
          return;
        }
        cycleValue = repetitiveMonth.value;
      }
      if(cycleEndTime == ""){
        Toast.show({
          type: 'error',
          content: '周期结束时间不能为空',
          onHide: function () {}
        });
        return;
      }
      let meetingStartTime = new Date(startTime);
      if(new Date(meetingStartTime.getFullYear() + "-" + (meetingStartTime.getMonth() + 1) + "-" + meetingStartTime.getDate()).getTime() > new Date(cycleEndTime).getTime()){
        Toast.show({
          type: 'error',
          content: '周期结束日期要不小于会议开始日期',
          onHide: function () {}
        });
        return;
      }
    }
    if (this.state.name=='') {
      Toast.show({
              type: 'error',
              content: '请填写会议名称',
              onHide: function () {
              }
          });
      return;
    }else if (this.state.meetingType==null) {
      Toast.show({
              type: 'error',
              content: '请选择会议类型',
              onHide: function () {
              }
          });
      return;
    }else if(!this.validateText(this.state.name, '会议名称')){
      return;
    }else if(this.state.name.length > 20){
      Toast.show({
        type: 'error',
        content: '名称不能超过20个字符',
        onHide: function () {}
      });
      return;
    }
    var theme = this.state.theme;
    if(theme!=null && theme!=undefined && theme.length>200){
      Toast.show({
        type: 'error',
        content: '会议内容不能超过200个字符',
        onHide: function () {}
      });
      return;
    } 
    if(theme != null && isEmojiCharacter(theme)){
      Toast.show({
        type: 'error',
        content: '会议内容不支持表情输入',
        onHide: function () {}
      });
      return;
    }
    let jsonStrEmceeUser = this.state.jsonStrEmceeUser;
    if(jsonStrEmceeUser==null || jsonStrEmceeUser==undefined || jsonStrEmceeUser.length==0){
      jsonStrEmceeUser = "";
    }else{
      jsonStrEmceeUser = JSON.stringify(jsonStrEmceeUser);
    }
    //会议签到
    let signedTime = "",signedType = "",signedRange = "";
    let addressList = "";
    if(this.state.meetingSign){
      //签到方式
      if(this.state.signType != null){
        signedType = this.state.signType.value;
        //有效范围
        if(signedType=="1" || signedType=="2"){
          signedRange = this.state.signRange.value;
          var addr = this.state.addressList;
          if(addr.length <= 0){
            Toast.show({
              type: 'error',
              content: '请选择签到地址',
              onHide: function () {
              }
            });
            return;
          }else{
            addressList = JSON.stringify(addr);
          }
        }
      }

      //签到时间
      if (this.state.signTime != null) {
        signedTime = this.state.signTime.value;
      }
    }
    let remark = this.state.remark;
    if(remark != null && isEmojiCharacter(remark)){
      Toast.show({
        type: 'error',
        content: '备注不支持表情输入',
        onHide: function () {}
      });
      return;
    }
    if(remark!="" && remark!=null && remark.length > 200){
      Toast.show({
        type: 'error',
        content: '备注不能超过200字符',
        onHide: function () {}
      });
      return ;
    }

    // 提醒时间
    let noticeTime = '';
    if (this.state.remindTime != null) {
        noticeTime = this.state.remindTime.value;
    }
  
    let isNotice = '';
    let noticeType = ''
    if (this.state.meetingRemind) {
      isNotice = '1';
      noticeType = '2';
    } else {
      isNotice = '0';
    } 

    let isSigned = '';
    if (this.state.meetingSign) {
      isSigned = '1';
    } else {
      isSigned = '0';
    }

    var jsonStrMemoUser = this.state.jsonStrMemoUser;
    if(jsonStrMemoUser==null || jsonStrMemoUser==undefined || jsonStrMemoUser.length==0){
      jsonStrMemoUser = "";
    }else{
      jsonStrMemoUser = JSON.stringify(jsonStrMemoUser);
    }
    var jsonStrAttendUser = this.state.jsonStrAttendUser;
    if(jsonStrAttendUser==null || jsonStrAttendUser==undefined || jsonStrAttendUser.length==0){
      jsonStrAttendUser = "";
    }else{
      jsonStrAttendUser = JSON.stringify(jsonStrAttendUser);
    }
    var jsonStrAttendants = this.state.jsonStrAttendants;
    if(jsonStrAttendants==null || jsonStrAttendants==undefined || jsonStrAttendants.length==0){
      jsonStrAttendants = "";
    }else{
      jsonStrAttendants = JSON.stringify(jsonStrAttendants);
    }

    let id = this.state.meetingId;
    let boardroomId = this.state.boardroomId;
    let address = this.state.address;
    if(this.state.view != 'edit'){
      if(this.state.meetingAddressType.value == 0){
        address = null;
      }else{
        id = null;
        boardroomId = null;
      }
    }else{
      id = this.state.oldId;
    }
    let param = {
      id:id,
      deleteId:this.state.meetingId,
      boardroomId: boardroomId,
      address: address,
      startTime:startTime,
      endTime:endTime,
      meetingServe:meetingServe,
      isCycle:isCycle ? 1 : 0,
      cycleType:cycleType,
      cycleValue:cycleValue,
      cycleEndTime:cycleEndTime,
      isSync:this.state.isSync,
      name:this.state.name,
      meetingType:this.state.meetingType.value,
      content:this.state.theme,
      jsonStrEmceeUser: jsonStrEmceeUser,
      jsonStrMemoUser: jsonStrMemoUser,
      jsonStrAttendUser: jsonStrAttendUser,
      jsonStrAttendants: jsonStrAttendants,
      meetingWay: this.state.meetingWay.value,
      messagePush:this.state.messagePush,
      isNotice:isNotice,
      noticeTime:noticeTime,
      noticeType:noticeType,
      isSigned:isSigned,
      signedTime:signedTime,
      signedType: signedType,
      signedRange: signedRange,
      addressList: addressList,
      fileId:this.state.fileId,
      remark: this.state.remark,
      isSyncCalendar:this.state.isSyncCalendar?1:0,
      meetingPeopleNum:this.state.meetingPeopleNum
    }
    if(this.state.meetingAddressType.value == 0 && this.state.meetingMode.value == 1 ){
      t.saveApplyBoardroomCycleMeeting(param);
    }else{
      t.saveInfo(param);
    }
  }

  saveApplyBoardroomCycleMeeting(param){
    let t = this;
    if(hasStart){
      return;
    }
    hasStart = true;
    DB.SomeModuleAPI.saveApplyBoardroomCycleMeeting({message: JSON.stringify(param)}).then((content) => {
      Toast.show({
        type: 'success',
          content: '提交成功'
       });
       //hasStart = false;
      setTimeout(function(){
        var view = t.state.view;
        if(view == "1"){
          backPage();
        }else if(view == "boardroom"){//从会议室发起会议
          history.go(-2);
        }else{
          //返回至列表页面
          history.back();
        }
      },1000);
    }).catch((error) => {
        hasStart = false;
        if(typeof(error.errorMsg) == 'undefined'){
          Toast.show({
          type: 'error',
          content: '提交出错'
           });
        }else{
          Toast.show({
          type: 'error',
          content: error.errorMsg
           });
        }
    });
  }

  saveInfo(param){
    let t = this;
    if(hasStart){
      return;
    }
    hasStart = true;
    DB.SomeModuleAPI.saveInfo({message: JSON.stringify(param)}).then((content) => {
      Toast.show({
        type: 'success',
          content: '提交成功'
       });
       //hasStart = false;
      setTimeout(function(){
        var view = t.state.view;
        if(view == "1"){
          backPage();
        }else if(view == "boardroom"){//从会议室发起会议
          history.go(-2);
        }else{
          //返回至列表页面
          history.back();
        }
      },1000);
    }).catch((error) => {
        hasStart = false;
        if(typeof(error.errorMsg) == 'undefined'){
          Toast.show({
          type: 'error',
          content: '提交出错'
           });
        }else{
          Toast.show({
          type: 'error',
          content: error.errorMsg
           });
        }
    });
  }

  //开始日期时间
  clickStartTime(value){
    var startTime = new Date(value.value).format("yyyy-MM-dd HH:mm");
    this.setState({
      startSelect: value,
      startTime: startTime
    });
    /*dd.biz.util.datetimepicker({
      format: 'yyyy-MM-dd HH:mm',
      value: t.state.startTime, //默认显示日期
      onSuccess : function(result) {
       t.setState({
        startTime:result.value
       });
      },
      onFail : function(err) {}
    })*/

  }

  //结束日期时间
  clickEndTime(value){
    let t = this;
    /*dd.biz.util.datetimepicker({
      format: 'yyyy-MM-dd HH:mm',
      value: t.state.endTime, //默认显示日期
      onSuccess : function(result) {
       t.setState({
        endTime:result.value
       });
      },
      onFail : function(err) {}
    })*/
    this.setState({
      endSelect: value,
      endTime: new Date(value.value).format("yyyy-MM-dd HH:mm")
    });
  }

  clickCycleEndTime(value){
    this.setState({
      cycleEndTimeSelect:value,
      cycleEndTime: new Date(value.value).format("yyyy-MM-dd")
    });
  }

  showSlot(id) {
    if(id=='startSlot' || id=='endSlot'){
      if(this.state.meetingAddressType.value == 1) 
        this[id].show();
    }else{
      this[id].show();
    }
  }

  getGeolocation(){
    let t = this;
    var range = parseInt(t.state.signRangeData);
    if(t.state.thirdMenuType=='DING'){
      dd.device.geolocation.get({
        targetAccuracy : range,
        coordinate: 1,
        withReGeocode: true,
        useCache: true, //默认是true，如果需要频繁获取地理位置，请设置false
        onSuccess : function(result) {
          t.setState({
            latitude : result.latitude,
            longitude: result.longitude
          });
        },
        onFail : function(err) {
        }
      });
    }else if(t.state.thirdMenuType=='WX'){
      wx.getLocation({
          type: 'wgs84', // 默认为wgs84的gps坐标，如果要返回直接给openLocation用的火星坐标，可传入'gcj02'
          success: function (res) {
            t.setState({
              latitude : res.latitude,
              longitude: res.longitude
            });
          }
      });
    }else if(t.state.thirdMenuType=='MH'){
      !!emp&&emp.getLocation({
          type: 'wgs84', // 默认为wgs84的gps坐标，如果要返回直接给openLocation用的火星坐标，可传入'gcj02'
          success: function (res) {
            t.setState({
              latitude : res.latitude,
              longitude: res.longitude
            });
          }
      });
    }
  }

  getPosition(position, address){
    let t = this;
    Popup.hide();
    var sAddr = t.state.addressList;
    for(var i=0;i<sAddr.length;i++){
      if(address == sAddr[i].address){
        Toast.show({
          type: 'error',
          content: '该地址已添加'
        });
        return false;
      }
    }
    var lng=117,lat=31;
    if(position != null){
      var positions = (position + "").split(',');
      if(positions.length == 2){
        lng = positions[0];
        lat = positions[1];
      }
    }
    var addr = {
      lng: lng + "",
      lat: lat + "",
      address: address
    };
    var addressList = t.state.addressList;
    addressList.push(addr);
    t.setState({
      addressList: addressList
    });
  }

  //添加签到地址
  addressEdit(){
    let t = this;
    let tempStamp= Date.now();
    window.history.pushState({
      adddress:tempStamp
    }, '', utils.addUrlParam('address', tempStamp));
    window.addEventListener('popstate', t.listener.bind(t), false);

    this.instance = Popup.show(
      <Map getPosition={this.getPosition.bind(this)} longitude={null} latitude={null}/>,
        {animationType:'slide-left'}
    );
  }

  listener(){
    Popup.hide();
    window.removeEventListener('popstate', this.listener.bind(this), false);
  }

  //删除已选签到地址
  delAddress(index){
    var addressList = this.state.addressList;
    addressList.splice(index,1);
    this.setState({
      addressList: addressList
    });
  }

  getCurrentTime(){
    var date = new Date();
    var minute = date.getMinutes();
    minute = Math.ceil(minute/30)*30;
    date.setMinutes(minute);
    return date.format("yyyy-MM-dd HH:mm");
  }
  
  changePic(imgid){
    var _fileId = "";
    imgid.map(function(item,index){
      _fileId += item.id+"|";
    });
    if(_fileId.length>1){
      _fileId = _fileId.substring(0,_fileId.length-1);
    }
    this.setState({
      attIdJson:imgid,
      fileId:_fileId
    });
  }

  selectBoardoom(){
    if(this.state.canSelectBoardroom){
      this.setState({ visible: true });
    }
  }

  canclePopup(){
    this.setState({ visible: false });
  }

  getBoardroomInfo(data){
    this.setState({
      meetingId: data.id,
      boardroomId: data.boardroomId,
      boardroomName: data.boardroomName,
      cycleId: data.cycleId,
      startTime: data.startTime,
      endTime: data.endTime,
      startSelect: {value: new Date(data.startTime).getTime()},
      endSelect: {value: new Date(data.endTime).getTime()},
      visible: false
    })
  }

  render() {
    const t = this;
    var addressHtml = "";
    var addressList = this.state.addressList;
    if(addressList!=null && addressList.length>0){
      addressHtml = addressList.map((item, index) => {
        return (
          <div className="dd-t-list-wrap">
            <HBox vAlign="center">
              <Box className="t-list-text-content" flex={1}>
                <VBox vAlign="center" className="t-list-text t-FBJ">
                  <Box>{item.address}</Box>
                </VBox>
              </Box>
              <Box className="t-PR6">
                <i className="iconfont icon-plus1 t-FCc t-rotate-45" onClick={t.delAddress.bind(this,index)}></i>
              </Box>
            </HBox>
          </div>
        );
      });
    }
    let maxDate = new Date();
    maxDate.setFullYear(maxDate.getFullYear() + 1);
    let minDate = new Date();
    minDate.setDate(minDate.getDate()-1);
    let limitDate = t.state.limitDate ? new Date(t.state.limitDate).getTime() : new Date(2051, 0, 1).getTime() - 1;
    return (
      <div className="page-add t-PB44">
        <Group.List>
          <TextField
            label="申请人"
            value={t.state.userName}
            readOnly={true}
          />
        </Group.List>
        <Group.List >
          <TextField
            label="所在部门"
            value={t.state.orgName}
            readOnly={true}
          />
        </Group.List>
        <Group.List >
          <TextField
            required
            label="会议名称"
            placeholder="请输入会议名称"
            value={t.state.name}
            readOnly={false}
            onChange={(value) => { t.handleTextChange('name', value, 20); }}>
          <Count total={20} length={t.state.name.length} />
          </TextField>
        </Group.List>
        {/* <Group.List >
          <TextareaField
            label="会议内容" minRows={2} maxRows={5}
            placeholder="请输入会议内容"
            value={t.state.theme}
            onChange={(value) => { t.handleTextChange('theme', value, 200); }}>
          <Count total={200} length={t.state.theme.length} />
          </TextareaField>
        </Group.List> */}
        <Group.List>
          <SelectField
            required
            label="会议类型"
            placeholder="请选择会议类型"
            options={this.state.meetingTypes}
            onSelect={this.typeChange.bind(this,'meetingType')}
            value={this.state.meetingType}
          />
        </Group.List>
        <Group.List>
          <SelectField 
            required
            readOnly={this.state.view == 'edit' ? true : false}
            label="会议模式"
            options={this.state.meetingModes}
            onSelect={this.typeChange.bind(this,'meetingMode')}
            value={this.state.meetingMode}
          />
        </Group.List>
        <Group.List>
          <SelectField
              required 
              // readOnly={this.state.view == 'edit' ? true : false}
              label="会议地点"
              options={this.state.meetingAddressTypes}
              onSelect={this.typeChange.bind(this,'meetingAddressType')}
              value={this.state.meetingAddressType}
            />
        </Group.List>
        <Group.List className={this.state.meetingAddressType.value == 0 ? '' : 't-DN'}>
            <HBox className="t-field-box t-FBAC">
              <HBox flex="1" onClick={() => {t.selectBoardoom('startSlot')}} className="t-FBAC">
                <Box flex="1"><span className={this.state.boardroomName?"t-FL t-FS16":"t-FL t-FS16 t-FCddfontblue-40"}>{this.state.boardroomName?this.state.boardroomName:"请选择已预定的会议室"}</span></Box>
                  <Box className="t-FBAC t-field-icon">
                    <AngleRight width={20} fill="#ccc"/>
                  </Box>
              </HBox>
            </HBox>
        </Group.List>
        <Group.List className={this.state.meetingAddressType.value == 1 ? '' : 't-DN'}>
          <TextField  
            label="" 
            placeholder="请输入会议地点" 
            value={this.state.address} 
            onChange={(value) => { t.handleTextChange('address', value, 20); }}>
          <Count total={20} length={t.state.address.length} />
          </TextField>
        </Group.List>
        <Group.List className={this.state.meetingAddressType.value == 1 ? '' : 't-DN'}>
            <CheckboxField
              data={this.state.meetingServerData}
              mode="slot"
              label="会议服务"
              onChange={this.typeChange.bind(this,'meetingServer')}
              required={false}
              />
        </Group.List>
        <Group.List>
            <HBox className="t-field-box t-FBAC">
              <div className="t-field-layout-h-label t-FS16 required" >开始时间</div>
              <HBox flex="1" onClick={() => {t.showSlot('startSlot')}} className="t-FBAC">
                <Box flex="1"><span className="t-FL t-FS16">{t.state.startTime}</span></Box>
                  <Box className="t-FBAC t-field-icon">
                    <AngleRight width={20} fill="#ccc"/>
                    <Datetime
                      locale="zh-cn"
                      minuteStep={5}
                      slotRef={(s) => t.startSlot = s}
                      title="日期选择"
                      value={t.state.startSelect}
                      columns={Datetime.YMDHM}
                      maxDate={limitDate}
                      onConfirm={(value) => { this.clickStartTime(value); }}
                    />
                  </Box>
              </HBox>
            </HBox>
        </Group.List>
        <Group.List>
            <HBox className="t-field-box t-FBAC">
              <div className="t-field-layout-h-label t-FS16 required" >结束时间</div>
              <HBox flex="1" onClick={() => {t.showSlot('endSlot')}} className="t-FBAC">
                <Box flex="1"><span className="t-FL t-FS16">{t.state.endTime}</span></Box>
                  <Box className="t-FBAC t-field-icon">
                    <AngleRight  width={20}  fill="#ccc"/>
                    <Datetime
                      locale="zh-cn"
                      minuteStep={5}
                      slotRef={(s) => t.endSlot = s}
                      title="日期选择"
                      value={t.state.endSelect}
                      columns={Datetime.YMDHM}
                      maxDate={limitDate}
                      onConfirm={(value) => { this.clickEndTime(value); }}
                    />
                  </Box>
              </HBox>
            </HBox>
        </Group.List>
        {/* <Group.List>
            <CheckboxField
              data={this.state.meetingServerData}
              mode="slot"
              label="会议服务"
              onChange={this.typeChange.bind(this,'meetingServer')}
              required={false}
              />
        </Group.List> */}
        <div className={this.state.isCycle ? '' : 't-DN'}>
          <Group.List >
            <SelectField
                label="重复类型"
                required
                options={t.state.cycleTypeData}
                onSelect={this.typeChange.bind(this,'cycleType')}
                value={this.state.cycleType}
              />
          </Group.List>
          <Group.List className={this.state.cycleType.value=='0' ? '' : 't-DN'}>
            <TextField
              required
              label="间隔天数"
              placeholder="请输入间隔天数"
              value={t.state.intervalDate}
              readOnly={false}
              onChange={(value) => { t.handleTextChange('intervalDate', value, 3); }}>
              <Count total={3} length={t.state.intervalDate.length} /></TextField>
          </Group.List>
          <Group.List className={this.state.cycleType.value=='1' ? '' : 't-DN'}>
              <CheckboxField
                data={t.state.repetitiveWeekData}
                mode="slot"
                label="重复星期"
                placeholder="请选择重复星期"
                onChange={this.typeChange.bind(this,'repetitiveWeek')}
                required={true}
              />
          </Group.List >
          <Group.List className={this.state.cycleType.value=='2' ? '' : 't-DN'}>
            <SelectField
                label="重复日期"
                required
                options={t.state.repetitiveMonthData}
                onSelect={this.typeChange.bind(this,'repetitiveMonth')}
                value={this.state.repetitiveMonth}
              />
          </Group.List>
          <Group.List>
              <HBox className="t-field-box t-FBAC">
                <div className="t-field-layout-h-label t-FS16 required" >结束日期</div>
                <HBox flex="1" onClick={() => {t.showSlot('cycleEndTime')}} className="t-FBAC">
                  <Box flex="1"><span className="t-FL t-FS16">{t.state.cycleEndTime}</span></Box>
                    <Box className="t-FBAC t-field-icon">
                      <AngleRight  width={20}  fill="#ccc"/>
                      <Datetime
                        locale="zh-cn"
                        slotRef={(s) => t.cycleEndTime = s}
                        title="日期选择"
                        minDate={minDate.getTime()}
                        maxDate={maxDate.getTime()}
                        value={t.state.cycleEndTimeSelect}
                        columns={Datetime.YMD}
                        onConfirm={(value) => { this.clickCycleEndTime(value); }}
                      />
                    </Box>
                </HBox>
              </HBox>
          </Group.List>
        </div>
        <div className="t-BCf7 t-H10"></div>
        
        <Group.List>
          <SelectMember
            required={false}
            readOnly={false}
            label="主持人"
            placeholder="请选择主持人"
            code="user"
            checkType="radio"
            fieldDataValue={t.state.emceeUser}
            scopeTable="oa_meeting_apply_record_scope"
            fieldTable="oa_meeting_apply_record"
            fieldData="emcee_user"
            // defaultValue={t.state.emceeUserList}
            ref="selectMember_emceeUser"
            isDelete={true}
            showType="list"
            onChange={this.changeSelectMember.bind(this,"jsonStrEmceeUser")}
          />
        </Group.List>
        <Group.List>
          <SelectMember
            required={false}
            readOnly={false}
            label="记录人"
            placeholder="请选择记录人"
            code="user"
            checkType="radio"
            fieldDataValue={t.state.memoUser}
            scopeTable="oa_meeting_apply_record_scope"
            fieldTable="oa_meeting_apply_record"
            fieldData="memo_user"
            ref="selectMember_memoUser"
            isDelete={true}
            showType="list"
            onChange={this.changeSelectMember.bind(this,"jsonStrMemoUser")}
          />
        </Group.List>
        <Group.List>
          <SelectMember
            required={false}
            readOnly={false}
            label="参会人员"
            placeholder="请选择参会人员"
            code="user,org,station,group"
            chooseType="userAndGroup,userAndOrg,personalGroup"
            checkType="checkbox"
            fieldDataValue={t.state.attendUser}
            scopeTable="oa_meeting_apply_record_scope"
            fieldTable="oa_meeting_apply_record"
            fieldData="attend_user"
            ref="selectMember_attendUser"
            isDelete={true}
            showType="list"
            onChange={this.changeSelectMember.bind(this,"jsonStrAttendUser")}
          />
        </Group.List>
        <Group.List>
          <SelectMember
            required={false}
            readOnly={false}
            label="会议列席人"
            placeholder="请选择会议列席人"
            code="user,org,station,group"
            chooseType="userAndGroup,userAndOrg,personalGroup"
            checkType="checkbox"
            fieldDataValue={t.state.attendants}
            scopeTable="oa_meeting_apply_record_scope"
            fieldTable="oa_meeting_apply_record"
            fieldData="meeting_attendants"
            ref="selectMember_attendants"
            isDelete={true}
            showType="list"
            onChange={this.changeSelectMember.bind(this,"jsonStrAttendants")}
          />
        </Group.List>
        <Group.List >
            <TextField
              label="会议人数"
              placeholder="请输入"
              value={t.state.meetingPeopleNum}
              readOnly={false}
              onChange={(value) => { t.handleTextChange('meetingPeopleNum', value, 4,"number"); }}>
              <Count total={4} length={t.state.meetingPeopleNum.length} /></TextField>
          </Group.List>
        <div className="t-BCf7 t-H10"></div>
        <Group.List>
            <SelectField
              label="会议方式"
              options={this.state.meetingWays}
              onSelect={this.typeChange.bind(this,'meetingWay')}
              value={this.state.meetingWay}
            />
        </Group.List>
        <Group.List className={t.state.messagePushSW != '' ? '' : 't-DN'}>
          <CheckboxField
            data={t.state.messagePushData}
            mode="slot"
            label="消息推送"
            onChange={this.changeMessagePush.bind(this)}
            required={false}
            />
        </Group.List>
        <div className={t.state.messagePushSW != '' ? 't-BCf7 t-H10' : 't-DN'}></div>
        <Group.List>
          <div className="dd-item">
            <label className="label-txt">同步至日程</label>
            <Switch on={this.state.isSyncCalendar} onChange={this.handleChange.bind(this, 'isSyncCalendar')} />
          </div>
        </Group.List>
        <Group.List>
          <div className="dd-item">
            <label className="label-txt">会议签到</label>
            <Switch on={this.state.meetingSign} onChange={this.handleChange.bind(this, 'meetingSign')} />
          </div>
        </Group.List>
        <div className={this.state.meetingSign ? '' : 't-DN'}>
          <Group.List borderTopNone={true}>
            <SelectField
              label="签到方式"
              options={this.state.signTypeData}
              onSelect={this.typeChange.bind(this,'signType')}
              value={this.state.signType}
            />
          </Group.List>
          <div className={ (this.state.signType.value=='1' || this.state.signType.value=='2') ? '' : 't-DN'}>
            <Group.List borderTopNone={true}>
              <SelectField
                label="有效范围"
                options={this.state.signRangeData}
                onSelect={this.typeChange.bind(this,'signRange')}
                value={this.state.signRange}
              />
            </Group.List>
            { addressHtml }
            <Group.List borderTopNone={true}>
              <div className="dd-t-list-wrap-single" onClick={this.addressEdit.bind(this)}>
                <HBox vAlign="center">
                  <Box><i className="t-circle t-FCf t-FS16 t-MR4 iconfont icon-plus t-BCgreen"></i></Box>
                  <Box className="t-FS16 t-LH2" flex={1}>添加签到地址</Box>
                </HBox>
              </div>
            </Group.List>
          </div>
          <Group.List borderTopNone={true}>
            <SelectField
              label="签到时间"
              options={this.state.signTimeData}
              onSelect={this.typeChange.bind(this,'signTime')}
              value={this.state.signTime}
            />
          </Group.List>
        </div>
        <div className="t-BCf7 t-H10"></div>
        {/* <div className={this.state.remindTypeData!=null && this.state.remindTypeData.length > 0 ? "":"t-DN"}> */}
        <div>
          <Group.List>
            <div className="dd-item">
              <label className="label-txt">会前提醒</label>
              <Switch on={this.state.meetingRemind} onChange={this.handleChange.bind(this, 'meetingRemind')} />
            </div>
          </Group.List>
          <Group.List className={this.state.meetingRemind ? '' : 't-DN'}>
            <SelectField
                label="提醒时间"
                options={remindTimeData}
                onSelect={this.typeChange.bind(this,'remindTime')}
                value={this.state.remindTime}
              />
          </Group.List>
          <div className="t-BCf7 t-H10"></div>
        </div>
        <Group.List className="t-PB16">
          <Upload
            label="附件"
            initList={t.state.attIdJson} 
            dir="meeting" 
            canAdd={true}
            canDel={true}
            limitNo="9"
            onChange={t.changePic.bind(this)}
            onDel={t.changePic.bind(this)}
            ref="upload"/>
          </Group.List>
        <Group.List>
          <TextareaField
            label="备注" minRows={2} maxRows={5}
            placeholder="请输入备注"
            value={t.state.remark}
            onChange={(value) => { t.handleTextChange('remark', value, 200); }}>
            <Count total={200} length={t.state.remark.length} />
            </TextareaField>
        </Group.List>
        <div >
          <Button type="primary" onClick={this.startMeeting.bind(this)}>保存</Button>
        </div>

        <Popup
          className="notice-popup"
          content={
            <SelectBoardoom 
              value={this.state.meetingId}
              selectCycleId={this.state.cycleId}
              isCycleBoardroom={this.state.meetingMode.value} 
              getBoardroomInfo={(data)=>{t.getBoardroomInfo(data)}}
              cancle={()=>{t.canclePopup();}}/>
          }
          animationType="slide-left"
          onMaskClick={() => { this.setState({ visible: false }); }}
          visible={this.state.visible}
        >
          {null}
        </Popup>
      </div>
    );
  }
}

